﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using TracedReality.RayTracing;
using TracedReality.RayTracing.PhotonMapping;

namespace TracedReality.Primitive
{
    /// <summary>
    /// Abstract class representing a light.
    /// </summary>
    public abstract class Light
    {
        /// <summary>
        /// The color of this Light.
        /// </summary>
        public Vector color;

        /// <summary>
        /// Determine how much light from this Light is received at the given Hit.
        /// May use random sampling.
        /// </summary>
        /// <param name="ray">The Ray that is being traced.</param>
        /// <param name="hit">The Hit containing the intersection info.</param>
        /// <param name="r">Random for sampling.</param>
        /// <returns>The contribution of this Light.</returns>
        public abstract Vector getContribution(Ray ray, Hit hit, Random r);

        /// <summary>
        /// Generates a Photon of the correct power and direction for photon mapping.
        /// </summary>
        /// <param name="num">The number of Photons that will be shot from this Light.</param>
        /// <param name="r">Random for sampling.</param>
        /// <returns>A Photon with correct power and direction.</returns>
        public abstract Photon generatePhoton(int num, Random r);
    }
}
